package com.ebt.m.data.entity;

import com.ebt.m.data.rxModel.apibean.ApiProduct;

/**
 * Created by Damon.Han on 2017/5/17 0017.
 *
 * @author Damon
 */

public class ProductInfoBridge {
    public static ProductInfo getProductInfoFromApi(ApiProduct apiProduct) {
        ProductInfo productInfo = new ProductInfo();
        productInfo.Id = apiProduct.getProductId();
        productInfo.ProductId = apiProduct.getProductId();
        productInfo.CompanyId = apiProduct.getBrandId();
        productInfo.CategoryId = apiProduct.getProductCategoryId();
        productInfo.CategoryName = apiProduct.getCategoryName();
        productInfo.Name = apiProduct.getName();
        productInfo.ShortName = apiProduct.getShortName();
        productInfo.Description = apiProduct.getDescription();
//        productInfo IsSale = //是否在售
        productInfo.Fenhongxingzhi = apiProduct.getHasDividends(); //是否有分红
        productInfo.Thumbnail = apiProduct.getThumbnail();
//        productInfo.IsShow =
        productInfo.GuaranteePeriod = apiProduct.getCoveragePeriod();
        productInfo.PaymentPeriod = apiProduct.getPaymentPeriod();
        productInfo.MinAge = apiProduct.getAccMinAge();
        productInfo.MaxAge = apiProduct.getAccMaxAge();
//        productInfo.StartSellingDate = //销售日期
//        productInfo.StopSellingDate = //停售日期
//        productInfo.SaleChannelIDs = //销售渠道
//        productInfo.IsProposaled = //产品在售标志
        productInfo.CompositionProperty = apiProduct.getCompositionProperty(); //组合属性
        productInfo.AccSex = Integer.valueOf(apiProduct.getAccSex());
        productInfo.ContractProperty = Integer.valueOf(apiProduct.getContractProperty());//合同属性-0附加险-1主险
        productInfo.AccOccupation = Integer.valueOf(apiProduct.getAccOccupation());//职业类别
//        productInfo.ExtendJSON = //扩展json
//        productInfo.insProductOptionsJson//投保选项json
        productInfo.companyName = apiProduct.getBrandName();
        productInfo.companyShortName = apiProduct.getBrandShortName();
        productInfo.modelMapBean = apiProduct.getModelMap();
//        productInfo.productWeight  /*产品排序-后台用*/
//        productInfo.Weight      /*产品排序(用于十大品牌)*/
//        productInfo.RecordTime          /*备案日期*/
        CompanyInfo companyInfo = new CompanyInfo();
        companyInfo.Id = apiProduct.getBrandId();
        companyInfo.Name = apiProduct.getBrandName();
        companyInfo.ShortName = apiProduct.getBrandShortName();
        productInfo.setCompanyInfo(companyInfo);
        return productInfo;
    }

}
